package com.ezandroid.module.network.request;

import android.text.TextUtils;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 封装的Simple Request
 *
 * @author markmjw
 * @date 2014-11-06
 */
public abstract class HttpSimpleRequest extends HttpBaseRequest<String> {

    public HttpSimpleRequest(String url) {
        super(url);
    }

    public HttpSimpleRequest(String url, String nodeName) {
        super(url, nodeName);
    }

    public HttpSimpleRequest(int method, String url, String nodeName) {
        super(method, url, nodeName);
    }

    @Override
    protected String parseResponse(String content, JSONObject json) throws JSONException {
        String result = content;
        if (!TextUtils.isEmpty(mNodeName)) {
            result = json.optString(mNodeName, content);
        }
        return result;
    }
}